# 第二课堂管理系统启动脚本
# 此脚本用于清理重复的Mapper XML文件并启动系统

Write-Host "===== 第二课堂管理系统启动脚本 ====="
Write-Host "正在准备启动系统..."

# 1. 清理项目
Write-Host "步骤1: 清理项目..."
mvn clean
Write-Host "清理完成！"

# 2. 编译项目
Write-Host "步骤2: 编译项目..."
mvn package -DskipTests
Write-Host "编译完成！"

# 3. 删除重复的Mapper XML文件
Write-Host "步骤3: 删除重复的Mapper XML文件..."
$adminMapperPath = ".\scms-admin\target\classes\mapper\secondclass"
if (Test-Path $adminMapperPath) {
    Write-Host "正在删除 $adminMapperPath 目录中的Mapper XML文件..."
    Remove-Item -Path "$adminMapperPath\*.xml" -Force
    Write-Host "删除完成！"
} else {
    Write-Host "$adminMapperPath 目录不存在，无需删除。"
}

# 4. 启动系统
Write-Host "步骤4: 启动系统..."
Write-Host "系统正在启动，请稍候..."
cd scms-admin
java -jar target/scms-admin.jar 